package org.lzuploader.model.account;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * This class contains data for a World of Warcraft account: name, server, password, ...
 * @author Emmanuel Cron
 *
 */
public class Account implements Serializable
{
    /** Serial UID of this class. */
    private static final long serialVersionUID = -6201533379340073548L;

    /** Name of the account (in WTF folder). */
    private String name;
    
    /** Name of the server selected for this account. */
    private String server;
    
    /**
     * An association between server names and their authentification configuration.
     */
    private Map<String, AccountServerConfig> serverConfigs = new HashMap<String, AccountServerConfig>();
    
    /**
     * Creates a new object with the given name.
     * @param nName The name of this account.
     */
    public Account(final String nName)
    {
        name = nName;
    }
    
    /**
     * Returns the name of this account.
     * @return The name of this account.
     */
    public String getName()
    {
        return name;
    }
    
    /**
     * Returns the selected server for this account.
     * @return The server or <code>null</code> if none selected.
     */
    public String getServer()
    {
        return server;
    }
    
    /**
     * Sets the selected server for this account.
     * @param nServer The newly selected server.
     */
    public void setServer(final String nServer)
    {
        server = nServer;
    }
    
    /**
     * Return the server configurations associated to this account.
     * @return A {@link Map} containing the name of the server and its associated configuration.
     */
    public Map<String, AccountServerConfig> getServerConfigs()
    {
        return serverConfigs;
    }
}
